import { Component } from 'react'

class State extends Component {
  state = {
    counts: 0,
  }
  addState = () => {
    let newArr = this.state.counts + 1
    this.setState({
      counts: newArr,
    })
  }
  render() {
    return (
      <div>
        定义状态 counts:{this.state.counts}
        <button onClick={this.addState}> ++ </button>
      </div>
    )
  }
}

export default State
